package com.aizuda.boot.modules.business.performancePlan.entity;

import com.aizuda.boot.modules.common.constant.enums.CollectionIntervalTypeEnum;
import com.aizuda.boot.modules.common.constant.enums.CycleTypeEnum;
import com.aizuda.boot.modules.common.constant.enums.PaymentTimeTypeEnum;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 收款计划实体类
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("collection_plan")
@Schema(description = "收款计划实体")
public class CollectionPlanEntity {

    @TableId(type = IdType.AUTO)
    @Schema(description = "主键ID")
    private Integer id;

    @Schema(description = "合同ID")
    @TableField("contract_id")
    private Integer contractId;

    @Schema(description = "是否为周期计划（0=否，1=是）")
    @TableField("is_cycle_plan")
    private Integer isCyclePlan;

    @Schema(description = "收款频率")
    @TableField("collection_frequency")
    private Integer collectionFrequency;

    @Schema(description = "周期类型（年、月、周、日）")
    @TableField("cycle_type")
    private CycleTypeEnum cycleType;

    @Schema(description = "首次收款时间")
    @TableField("first_collection_date")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate firstCollectionDate;

    @Schema(description = "总期数")
    @TableField("total_periods")
    private Integer totalPeriods;

    @Schema(description = "计划组ID")
    @TableField("plan_group_id")
    private Integer planGroupId;

    @Schema(description = "排序")
    private Integer sort;

    @Schema(description = "履约类型（0=无收款，1=有收款）")
    @TableField("fulfillment_type")
    private Integer fulfillmentType;

    @Schema(description = "履约事项")
    @TableField("fulfillment_item")
    private String fulfillmentItem;

    @Schema(description = "收款时间类型（固定收款日期、无固定日期、履约完成后）")
    @TableField("collection_time_type")
    private PaymentTimeTypeEnum collectionTimeType;

    @Schema(description = "收款日期（若为固定时间类型）")
    @TableField("collection_date")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate collectionDate;

    @Schema(description = "收款金额")
    @TableField("collection_amount")
    private Integer collectionAmount;

    @Schema(description = "货币类型（如CNY、USD等）")
    @TableField("currency_type")
    private String currencyType;

    @Schema(description = "交易方ID")
    @TableField("partner_id")
    private Integer partnerId;

    @Schema(description = "收款对象ID")
    @TableField("collection_receiver_id")
    private Integer collectionReceiverId;

    @Schema(description = "收款对象")
    @TableField("collection_receiver")
    private String collectionReceiver;

    @Schema(description = "收款间隔")
    @TableField("collection_interval")
    private Integer collectionInterval;

    @Schema(description = "收款间隔类型（自然日、工作日）")
    @TableField("collection_interval_type")
    private CollectionIntervalTypeEnum collectionIntervalType;

    @Schema(description = "收款说明")
    @TableField("collection_note")
    private String collectionNote;

    @Schema(description = "创建时间")
    @TableField("create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @Schema(description = "更新时间")
    @TableField("update_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
}
